/**
 * Created by oneminute on 2014/5/18.
 */

var lz = require("../utils/modules")();
var moment = require("moment");

function Gift(_opts) {
    lz.Persistent.call(this, _opts);
    if (!_opts) _opts = {};
    var now = moment();
    this.__properties.pushArray([
        { name: "id", value: _opts.id || "" },
        { name: "uid", value: _opts.uid || "" },
        { name: "description", value: _opts.description || "" },
        { name: "finished", value: false },
        { name: "publishDate", value: now.format(lz.Config.datetimeFormat) },
        { name: "expireDate", value: now.add('d', lz.Config.business.needExpire).format(lz.Config.datetimeFormat) }
    ]);
    this.__initProperties();
    this.__collection = lz.Config.db.arango.gifts;
    this.__aql = lz.Config.db.arango.aqls.GET_OBJECT_BY_PROPERTY;
}

require("util").inherits(Gift, lz.Persistent);

exports = module.exports = Gift;
